home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / g_man / cat3 / ftn / texgen.z / texgen
Encoding:
Text File  |  2002-10-03  |  10.5 KB  |  257 lines

  1.  
  2.  
  3.  
  4. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      tttteeeexxxxggggeeeennnn - specify automatic generation of texture coordinates
  10.  
  11. FFFFOOOORRRRTTTTRRRRAAAANNNN SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  12.      ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee tttteeeexxxxggggeeeennnn((((ccccoooooooorrrrdddd,,,, mmmmooooddddeeee,,,, ppppaaaarrrraaaammmmssss))))
  13.      iiiinnnntttteeeeggggeeeerrrr****4444 ccccoooooooorrrrdddd,,,, mmmmooooddddeeee
  14.      rrrreeeeaaaallll ppppaaaarrrraaaammmmssss(((())))
  15.  
  16. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  17.      _c_o_o_r_d    Expects the name of the texture coordinate whose generation is
  18.               to be defined, enabled, or disabled.  One of:
  19.  
  20.               TTTTXXXXSSSS:  The _s texture coordinate
  21.  
  22.               TTTTXXXXTTTT:  The _t texture coordinate
  23.  
  24.               TTTTXXXXRRRR:  The _r texture coordinate
  25.  
  26.               TTTTXXXXQQQQ:  The _q texture coordinate
  27.  
  28.      _m_o_d_e     Expects the mode of generation to be specified, or an indication
  29.               that generation is to be either enabled or disabled.  One of the
  30.               symbolic constants:
  31.  
  32.               TTTTGGGGCCCCOOOONNNNTTTT:  Use the plane equation specified in _p_a_r_a_m_s to define a
  33.               plane in eye-coordinates.  Generate a texture coordinate that is
  34.               proportional to vertex distance from this plane.
  35.  
  36.               TTTTGGGGLLLLIIIINNNNEEEE:  Use the plane equation specified in params to define a
  37.               plane in object-coordinates.  Generate a texture coordinate that
  38.               is proportional to vertex distance from this plane.
  39.  
  40.               TTTTGGGGSSSSPPPPHHHHEEEE:  Generate texture coordinates based on the vertex and
  41.               current normal.  When used with the appropriate texture
  42.               (described below), this gives the appearance of the reflection
  43.               of an environment placed at infinity.  Typically, both TTTTXXXXSSSS or
  44.               TTTTXXXXTTTT are enabled.
  45.  
  46.               TTTTGGGGOOOONNNN:  Enable the (previously defined) replacement for the
  47.               specified texture coordinate.
  48.  
  49.               TTTTGGGGOOOOFFFFFFFF:  Disable replacement of the specified texture coordinate
  50.               (the default).
  51.  
  52.      _p_a_r_a_m_s   Expects a 4-component plane equation when _m_o_d_e is TTTTGGGGCCCCOOOONNNNTTTT or
  53.               TTTTGGGGLLLLIIIINNNNEEEE.  Array element 1 is plane equation component A, 2 is B,
  54.               3 is C, and 4 is D.  The specified contents of _p_a_r_a_m_s are
  55.               insignificant when _m_o_d_e is TTTTGGGGOOOONNNN, TTTTGGGGOOOOFFFFFFFF, or TTTTGGGGSSSSPPPPHHHHEEEE.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  71.  
  72.  
  73.  
  74. DESCRIPTION
  75.      Texture coordinates _s, _t, _r, and _q can be specified directly using the tttt
  76.      command.  It is also possible to have texture coordinates generated
  77.      automatically as a function of object geometry.  tttteeeexxxxggggeeeennnn specifies,
  78.      enables, and disables such automatic generation.  Either or both texture
  79.      coordinates can be generated independently.  Automatic texture coordinate
  80.      generation is disabled by default.
  81.  
  82.      tttteeeexxxxggggeeeennnn supports three generation algorithms:  TTTTGGGGLLLLIIIINNNNEEEE, TTTTGGGGCCCCOOOONNNNTTTT, and TTTTGGGGSSSSPPPPHHHHEEEE.
  83.      TTTTGGGGLLLLIIIINNNNEEEE operates directly on object coordinates, and is therefore most
  84.      useful for textures that are locked to objects, such as ground texture
  85.      locked to a terain, or metalic texture locked to a cylinder.  TTTTGGGGCCCCOOOONNNNTTTT
  86.      operates on eye-coordinates.  It supports motion of an object through a
  87.      `field' of texture coordinates.  TTTTGGGGSSSSPPPPHHHHEEEE computes a reflection based on
  88.      the vertex and normal in eye-coordinates.
  89.  
  90.      Both modes TTTTGGGGLLLLIIIINNNNEEEE and TTTTGGGGCCCCOOOONNNNTTTT define a texture coordinate generation
  91.      function that is a linear function of distance from a plane.  The plane
  92.      equation is specified as a single, 4-component, vector in object
  93.      coordinates.
  94.  
  95.  
  96.           Pobject = |||| dcba ||||
  97.      The TTTTGGGGLLLLIIIINNNNEEEE plane equation remains in object-coordinates.  The TTTTGGGGCCCCOOOONNNNTTTT
  98.      plane equation is transformed by the ModelView matrix into eye-
  99.      coordinates when it is defined:
  100.  
  101.           Peye = MModelView-1       Pobject
  102.      When a generation function has been defined for a texture coordinate, and
  103.      tttteeeexxxxggggeeeennnn has been called with TTTTGGGGOOOONNNN, each vertex presented to the graphics
  104.      system has that texture coordinate value replaced with the distance of
  105.      the vertex from the defined plane.  For example, when texture coordinate
  106.      _s is generated by a TTTTGGGGLLLLIIIINNNNEEEE function, the generation function is:
  107.  
  108.  
  109.           s = Vobject.Pobject = || xobject, yobject, zobject, wobject||.|||| dcba ||||
  110.      Alternately, when _t is generated by a TTTTGGGGCCCCOOOONNNNTTTT function, the generation
  111.      function is:
  112.  
  113.           t = Veye.Peye
  114.      where
  115.  
  116.           Veye = Vobject MModelView,
  117.  
  118.  
  119.  
  120.  
  121.                                                                         PPPPaaaaggggeeee 2222
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  129.  
  130.  
  131.  
  132.      and
  133.  
  134.           Peye = MModelView-1       Pobject
  135.      Note that the ModelView matrix that modifies the plane equation is the
  136.      ModelView matrix in effect when tttteeeexxxxggggeeeennnn was called, while the ModelView
  137.      matrix that modifies the vertex coordinates is the matrix used to
  138.      transform that vertex.
  139.  
  140.      The creation of an appropriate texture for TTTTGGGGSSSSPPPPHHHHEEEE requires some
  141.      explanation.  Consider a unit sphere centered at the viewpoint which
  142.      represents the complete environment.  The mapping of this sphere to a 2D
  143.      texture is captured with a formula, given below.
  144.  
  145.      Let _R be an arbitrary unit vector based at the viewpoint.  _s and _t are
  146.      texture coordinates in the range 0.0 to 1.0.  The texture value is taken
  147.      from the point of intersection between _R and the unit sphere.  The set of
  148.      all possible values of _R captures the complete environment.  The mapping
  149.      from _R to texture coordinates _s and _t is:
  150.  
  151.                mag = 2*sqrt(R.x*R.x+R.y*R.y+(R.z+1)*(R.z+1))
  152.  
  153.                s = R.x/mag+.5
  154.  
  155.                t = R.y/mag+.5
  156.  
  157.      The point in the environment directly behind the viewer maps to _s = .5, _t
  158.      = .5.  The intersection between the plane _z = 0 and the environment maps
  159.      to a circle centered at _s = .5, _t = .5 with a radius of sqrt(2)/4.  The
  160.      point in the environment directly in front of the viewer maps to a circle
  161.      with a radius of .5.  This circle marks the boundary of the complete
  162.      environment in the texture.  In a reflection, this boundary can be
  163.      approached but not reached.  Since the view direction is fixed for each
  164.      environment texture, a change in the view direction will require a new
  165.      texture to be calculated.
  166.  
  167.      tttteeeexxxxggggeeeennnn generation functions remain valid until they are redefined.  They
  168.      are enabled and disabled without redefinition by calls to tttteeeexxxxggggeeeennnn with
  169.      modes TTTTGGGGOOOONNNN and TTTTGGGGOOOOFFFFFFFF.  tttteeeexxxxggggeeeennnn definition has no effect on the enable mode
  170.      of the texture generation function.
  171.  
  172.      When enabled, tttteeeexxxxggggeeeennnn replaces _s, _t, or both each time a vertex command is
  173.      received.  A texture coordinate that is not being generated continues to
  174.      be specified by tttt commands.  Texture coordinate are transformed by the
  175.      Texture matrix (see mmmmmmmmooooddddeeee) following coordinate replacement by tttteeeexxxxggggeeeennnn.
  176.  
  177. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  178.      mmode, n, t, texdef, texbin, tevdef, tevbin, v
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.                                                                         PPPPaaaaggggeeee 3333
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  194.  
  195.  
  196.  
  197. NOTES
  198.      IRIS-4D G, GT, and GTX models, and the Personal Iris, do not support
  199.      texture mapping.  tttteeeexxxxggggeeeennnn is ignored by these machines.  The Iris Indy,
  200.      Indigo Entry, and XL support texture mapping except for lines.  IRIS-4D
  201.      VGX and VGXT models, the Personal Iris, Indy, Indigo Entry, XS, XS24, XZ,
  202.      Elan and Extreme systems do not support TTTTXXXXRRRR and TTTTXXXXQQQQ Use ggggeeeettttggggddddeeee to
  203.      determine whether texture mapping is supported.
  204.  
  205.      tttteeeexxxxggggeeeennnn cannot be used while mmmmmmmmooooddddeeee is MMMMSSSSIIIINNNNGGGGLLLL.
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.                                                                         PPPPaaaaggggeeee 4444
  253.  
  254.  
  255.  
  256.